<!-- Main Header -->
<header class="main-header">

    <!-- Logo -->
    <a href="/{{ trim(config('admin.prefix'), '/') }}" class="logo">
        <!-- mini logo for sidebar mini 50x50 pixels -->
        <span class="logo-mini">{!! config('admin.logo-mini', config('admin.name')) !!}</span>
        <!-- logo for regular state and mobile devices -->
        <span class="logo-lg">{!! config('admin.logo', config('admin.name')) !!}</span>
    </a>

    <!-- Header Navbar -->
    <nav class="navbar navbar-static-top" role="navigation">
        <!-- Sidebar toggle button-->
        <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
            <span class="sr-only">Toggle navigation</span>
        </a>
        <!-- Navbar Right Menu -->
        <div class="navbar-custom-menu">
            <ul class="nav navbar-nav">
              <!-- 专员和经理消息提醒 -->
              @if(Admin::user()->isRole('zhuanyuan') || Admin::user()->isRole('zhuguan'))
                <!-- 跟单提醒和回访消息提醒 -->
                <li class="dropdown messages-menu">
                  <a href="https://adminlte.io/themes/AdminLTE/index2.html#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                    <i class="fa fa-envelope-o"></i>
                    <span class="label label-success" id="shuliang">
                    
                    </span>
                  </a>
                  <ul class="dropdown-menu">
                    <li class="header" id="shuliang2">
                    
                    </li>
                    <li>
                      <!-- inner menu: contains the actual data -->
                      <ul class="menu" id="xiaoli">
                        
                      </ul>
                    </li>
                  </ul>
                </li>
                <!-- 收款 请款 核算消息提醒 -->
                <li class="dropdown notifications-menu">
                  <a href="https://adminlte.io/themes/AdminLTE/index2.html#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                    <i class="fa fa-bell-o"></i>
                    <span class="label label-warning" id="qkxiaoxi">

                    </span>
                  </a>
                  <ul class="dropdown-menu">
                    <li class="header" id="qkxiaoxi2">

                    </li>
                    <li>
                      <ul class="menu" id="qkxiaoxi3">
                        
                      </ul>
                    </li>
                  </ul>
                </li>
                <!-- 发团日期前一天消息提醒 -->
                <li class="dropdown tasks-menu">
                  <a href="https://adminlte.io/themes/AdminLTE/index2.html#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                    <i class="fa fa-flag-o"></i>
                    <span class="label label-danger" id="fatuan">

                    </span>
                  </a>
                  <ul class="dropdown-menu">
                    <li class="header" id="fatuan2">

                    </li>
                    <li>
                      <ul class="menu" id="fatuan3">
                        
                      </ul>
                    </li>
                  </ul>
                </li>
                <script>
                    $(function(){
                      function zhuanyuan(){
                        $.ajax({
                            type: "get",
                            dataType: "json",
                            url: "{{admin_url('xiaoxi/zhuanyuan')}}",
                            success: function (data) {
                              // 跟单提醒和回访提醒
                                $("#shuliang").text(data.shuliang);
                                $("#shuliang2").text("跟单提醒和回访提醒");
                                var aa="";
                                for(var i=0;i<data.gendan.length;i++){
                                  aa+="<li><a href=\"{{admin_url('crm_order')}}/"+data.gendan[i]['order_id']+"/edit\"><div class=\"pull-left\"><p>跟单提醒</p></div><h4><small><i class=\"fa fa-clock-o\"></i>"+data.gendan[i]['date']+" </small></h4><p> &nbsp &nbsp 一条跟单记录需要回访</p></a></li>";
                                }
                                for(var i=0;i<data.huifang.length;i++){
                                  aa+="<li><a href=\"{{admin_url('crm_order')}}/"+data.huifang[i]['orderid']+"/edit\"><div class=\"pull-left\"><p>回访提醒</p></div><h4><small><i class=\"fa fa-clock-o\"></i>"+data.huifang[i]['date']+" </small></h4><p> &nbsp &nbsp "+data.huifang[i]['title']+"</p></a></li>";
                                }
                                $("#xiaoli").html(aa);
                              // 出游日期提醒
                                $("#fatuan").text(data.fatuan);
                                $("#fatuan2").text("出游日期提醒");
                                var bb="";
                                for(var i=0;i<data.chufa.length;i++){
                                  bb+="<li><a href=\"{{admin_url('fatuan')}}/"+data.chufa[i]['id']+"\/"+data.chufa[i]['deal_orderid']+"\"><h3>发团提醒<small class=\"pull-right\">"+data.chufa[i]['deal_ftdate']+"</small></h3><div><small>&nbsp &nbsp 一条出游信息提醒</small></div></a></li>";
                                }
                                $("#fatuan3").html(bb);
                              // 请款审批，收款审批，核算审批消息提醒 
                                $("#qkxiaoxi").text(data.qkshu);
                                $("#qkxiaoxi2").text("请款，收款，核算 审批消息提醒");
                                var cc="";
                                var skuanzt = new Array();
                                skuanzt[2] = "通过";
                                skuanzt[3] = "驳回";
                                for(var i=0;i<data.skxiaoxi.length;i++){
                                  cc+="<li><a href=\"{{admin_url('skxiaoxi')}}/"+data.skxiaoxi[i]['id']+"\/"+data.skxiaoxi[i]['receive_orderid']+"\"><i class=\"fa fa-users text-aqua\"></i>&nbsp &nbsp &nbsp &nbsp一条收款审批"+skuanzt[data.skxiaoxi[i]['receive_statue']]+"</a></li>";
                                }
                                for(var i=0;i<data.qkxiaoxi.length;i++){
                                  cc+="<li><a href=\"{{admin_url('qkxiaoxi')}}/"+data.qkxiaoxi[i]['id']+"\/"+data.qkxiaoxi[i]['funds_orderid']+"\"><i class=\"fa fa-users text-red\"></i>&nbsp &nbsp &nbsp &nbsp一条请款审批"+skuanzt[data.qkxiaoxi[i]['funds_statue']]+"</a></li>";
                                }
                                for(var i=0;i<data.jsxiaoxi.length;i++){
                                  cc+="<li><a href=\"{{admin_url('jsxiaoxi')}}/"+data.jsxiaoxi[i]['id']+"\/"+data.jsxiaoxi[i]['deal_orderid']+"\"><i class=\"fa fa-shopping-cart text-green\"></i>&nbsp &nbsp &nbsp &nbsp一条成交单核算完毕</a></li>";
                                }
                                $("#qkxiaoxi3").html(cc);
                            }
                        });
                      }
                      zhuanyuan();
                      setInterval(zhuanyuan,10*1000);
                    });
                </script>
              @endif
              <!-- 财务消息提醒 -->
              @if(Admin::user()->isRole('caiwu'))
                <!-- 收款审批提醒 -->
                <li class="dropdown messages-menu">
                  <a href="https://adminlte.io/themes/AdminLTE/index2.html#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                    <i class="fa fa-envelope-o"></i>
                    <span class="label label-success" id="cwshoukuan">
                    
                    </span>
                  </a>
                  <ul class="dropdown-menu">
                    <li class="header" id="cwshoukuan2">
                    
                    </li>
                    <li>
                      <!-- inner menu: contains the actual data -->
                      <ul class="menu" id="cwshoukuan3">
                        
                      </ul>
                    </li>
                  </ul>
                </li>
                <!-- 请款审批提醒 -->
                <li class="dropdown notifications-menu">
                  <a href="https://adminlte.io/themes/AdminLTE/index2.html#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                    <i class="fa fa-bell-o"></i>
                    <span class="label label-warning" id="cwqingkuan">

                    </span>
                  </a>
                  <ul class="dropdown-menu">
                    <li class="header" id="cwqingkuan2">

                    </li>
                    <li>
                      <ul class="menu" id="cwqingkuan3">
                        
                      </ul>
                    </li>
                  </ul>
                </li>
                <!-- 结算审批提醒 -->
                <li class="dropdown tasks-menu">
                  <a href="https://adminlte.io/themes/AdminLTE/index2.html#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                    <i class="fa fa-flag-o"></i>
                    <span class="label label-danger" id="cwjiesuan">

                    </span>
                  </a>
                  <ul class="dropdown-menu">
                    <li class="header" id="cwjiesuan2">

                    </li>
                    <li>
                      <ul class="menu" id="cwjiesuan3">
                        
                      </ul>
                    </li>
                  </ul>
                </li>
                <script>
                    $(function(){
                      function caiwu(){
                        $.ajax({
                            type: "get",
                            dataType: "json",
                            url: "{{admin_url('xiaoxi/caiwu')}}",
                            success: function (data) {
                              // 收款审批提醒
                                $("#cwshoukuan").text(data.shuliang);
                                $("#cwshoukuan2").text("收款审批提醒");
                                var aa="";
                                for(var i=0;i<data.skshenpi.length;i++){
                                  aa+="<li><a href=\"{{admin_url('crm_receive')}}\"><div class=\"pull-left\"><p>收款提醒</p></div><h4><small><i class=\"fa fa-clock-o\"></i>"+data.skshenpi[i]['receive_date']+" </small></h4><p> &nbsp &nbsp 一条收款等待审批</p></a></li>";
                                }
                                for(var i=0;i<data.gendan.length;i++){
                                  aa+="<li><a href=\"{{admin_url('crm_order')}}/"+data.gendan[i]['order_id']+"/edit\"><div class=\"pull-left\"><p>跟单提醒</p></div><h4><small><i class=\"fa fa-clock-o\"></i>"+data.gendan[i]['date']+" </small></h4><p> &nbsp &nbsp 一条跟单记录需要回访</p></a></li>";
                                }
                                for(var i=0;i<data.huifang.length;i++){
                                  aa+="<li><a href=\"{{admin_url('crm_order')}}/"+data.huifang[i]['orderid']+"/edit\"><div class=\"pull-left\"><p>回访提醒</p></div><h4><small><i class=\"fa fa-clock-o\"></i>"+data.huifang[i]['date']+" </small></h4><p> &nbsp &nbsp "+data.huifang[i]['title']+"</p></a></li>";
                                }
                                $("#cwshoukuan3").html(aa);
                              // 请款审批提醒
                                $("#cwqingkuan").text(data.fatuan);
                                $("#cwqingkuan2").text("请款审批提醒");
                                var bb="";
                                for(var i=0;i<data.qkshenpi.length;i++){
                                  bb+="<li><a href=\"{{admin_url('crm_funds')}}\">请款提醒<small class=\"pull-right\">"+data.qkshenpi[i]['funds_date']+"</small><div><small>&nbsp &nbsp 一条请款等待审批</small></div></a></li>";
                                }
                                for(var i=0;i<data.chufa.length;i++){
                                  bb+="<li><a href=\"{{admin_url('fatuan')}}/"+data.chufa[i]['id']+"\/"+data.chufa[i]['deal_orderid']+"\"><h3>发团提醒<small class=\"pull-right\">"+data.chufa[i]['deal_ftdate']+"</small></h3><div><small>&nbsp &nbsp 一条出游信息提醒</small></div></a></li>";
                                }
                                $("#cwqingkuan3").html(bb);
                              // 结算审批提醒 
                                $("#cwjiesuan").text(data.qkshu);
                                $("#cwjiesuan2").text("结算审批提醒");
                                var cc="";
                                for(var i=0;i<data.jsshenpi.length;i++){
                                  cc+="<li><a href=\"{{admin_url('crm_deal')}}\"><i class=\"fa fa-users text-aqua\"></i>&nbsp &nbsp &nbsp &nbsp您有一条成交单等待核算</a></li>";
                                }
                                for(var i=0;i<data.skxiaoxi.length;i++){
                                  cc+="<li><a href=\"{{admin_url('skxiaoxi')}}/"+data.skxiaoxi[i]['id']+"\/"+data.skxiaoxi[i]['receive_orderid']+"\"><i class=\"fa fa-users text-aqua\"></i>&nbsp &nbsp &nbsp &nbsp一条收款审批"+skuanzt[data.skxiaoxi[i]['receive_statue']]+"</a></li>";
                                }
                                for(var i=0;i<data.qkxiaoxi.length;i++){
                                  cc+="<li><a href=\"{{admin_url('qkxiaoxi')}}/"+data.qkxiaoxi[i]['id']+"\/"+data.qkxiaoxi[i]['funds_orderid']+"\"><i class=\"fa fa-users text-red\"></i>&nbsp &nbsp &nbsp &nbsp一条请款审批"+skuanzt[data.qkxiaoxi[i]['funds_statue']]+"</a></li>";
                                }
                                for(var i=0;i<data.jsxiaoxi.length;i++){
                                  cc+="<li><a href=\"{{admin_url('jsxiaoxi')}}/"+data.jsxiaoxi[i]['id']+"\/"+data.jsxiaoxi[i]['deal_orderid']+"\"><i class=\"fa fa-shopping-cart text-green\"></i>&nbsp &nbsp &nbsp &nbsp一条成交单核算完毕</a></li>";
                                }
                                $("#cwjiesuan3").html(cc);
                            }
                        });
                      }
                      caiwu();
                      setInterval(caiwu,10*1000);
                    });
                </script>
              @endif
              <!-- 总经理消息提醒 -->
              @if(Admin::user()->isRole('administrator'))
                <!-- 跟单提醒和回访消息提醒 -->
                <li class="dropdown messages-menu">
                  <a href="https://adminlte.io/themes/AdminLTE/index2.html#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                    <i class="fa fa-envelope-o"></i>
                    <span class="label label-success" id="shuliang">
                    
                    </span>
                  </a>
                  <ul class="dropdown-menu">
                    <li class="header" id="shuliang2">
                    
                    </li>
                    <li>
                      <!-- inner menu: contains the actual data -->
                      <ul class="menu" id="xiaoli">
                        
                      </ul>
                    </li>
                  </ul>
                </li>
                <!-- 收款 请款 核算消息提醒 -->
                <li class="dropdown notifications-menu">
                  <a href="https://adminlte.io/themes/AdminLTE/index2.html#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                    <i class="fa fa-bell-o"></i>
                    <span class="label label-warning" id="qkxiaoxi">

                    </span>
                  </a>
                  <ul class="dropdown-menu">
                    <li class="header" id="qkxiaoxi2">

                    </li>
                    <li>
                      <ul class="menu" id="qkxiaoxi3">
                        
                      </ul>
                    </li>
                  </ul>
                </li>
                <!-- 发团日期前一天消息提醒 -->
                <li class="dropdown tasks-menu">
                  <a href="https://adminlte.io/themes/AdminLTE/index2.html#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                    <i class="fa fa-flag-o"></i>
                    <span class="label label-danger" id="fatuan">

                    </span>
                  </a>
                  <ul class="dropdown-menu">
                    <li class="header" id="fatuan2">

                    </li>
                    <li>
                      <ul class="menu" id="fatuan3">
                        
                      </ul>
                    </li>
                  </ul>
                </li>
                <script>
                    $(function(){
                      function zhuanyuan(){
                        $.ajax({
                            type: "get",
                            dataType: "json",
                            url: "{{admin_url('xiaoxi/zongjingli')}}",
                            success: function (data) {
                              // 跟单提醒和回访提醒
                                $("#shuliang").text(data.shuliang);
                                $("#shuliang2").text("跟单提醒和回访提醒");
                                var aa="";
                                for(var i=0;i<data.gendan.length;i++){
                                  aa+="<li><a href=\"{{admin_url('crm_order')}}/"+data.gendan[i]['order_id']+"/edit\"><div class=\"pull-left\"><p>跟单提醒</p></div><h4><small><i class=\"fa fa-clock-o\"></i>"+data.gendan[i]['date']+" </small></h4><p> &nbsp &nbsp 一条跟单记录需要回访</p></a></li>";
                                }
                                for(var i=0;i<data.huifang.length;i++){
                                  aa+="<li><a href=\"{{admin_url('crm_order')}}/"+data.huifang[i]['orderid']+"/edit\"><div class=\"pull-left\"><p>回访提醒</p></div><h4><small><i class=\"fa fa-clock-o\"></i>"+data.huifang[i]['date']+" </small></h4><p> &nbsp &nbsp "+data.huifang[i]['title']+"</p></a></li>";
                                }
                                for(var i=0;i<data.dzshenpi.length;i++){
                                  aa+="<li><a href=\"{{admin_url('crm_funds')}}\"><div class=\"pull-left\"><p>垫资审批</p></div><h4><small><i class=\"fa fa-clock-o\"></i>"+data.dzshenpi[i]['funds_date']+" </small></h4><p> &nbsp &nbsp 一条垫资审批提醒</p></a></li>";
                                }
                                $("#xiaoli").html(aa);
                              // 出游日期提醒
                                $("#fatuan").text(data.fatuan);
                                $("#fatuan2").text("出游日期提醒");
                                var bb="";
                                for(var i=0;i<data.chufa.length;i++){
                                  bb+="<li><a href=\"{{admin_url('fatuan')}}/"+data.chufa[i]['id']+"\/"+data.chufa[i]['deal_orderid']+"\"><h3>发团提醒<small class=\"pull-right\">"+data.chufa[i]['deal_ftdate']+"</small></h3><div><small>&nbsp &nbsp 一条出游信息提醒</small></div></a></li>";
                                }
                                $("#fatuan3").html(bb);
                              // 请款审批，收款审批，核算审批消息提醒 
                                $("#qkxiaoxi").text(data.qkshu);
                                $("#qkxiaoxi2").text("请款，收款，核算 审批消息提醒");
                                var cc="";
                                var skuanzt = new Array();
                                skuanzt[2] = "通过";
                                skuanzt[3] = "驳回";
                                for(var i=0;i<data.skxiaoxi.length;i++){
                                  cc+="<li><a href=\"{{admin_url('skxiaoxi')}}/"+data.skxiaoxi[i]['id']+"\/"+data.skxiaoxi[i]['receive_orderid']+"\"><i class=\"fa fa-users text-aqua\"></i>&nbsp &nbsp &nbsp &nbsp一条收款审批"+skuanzt[data.skxiaoxi[i]['receive_statue']]+"</a></li>";
                                }
                                for(var i=0;i<data.qkxiaoxi.length;i++){
                                  cc+="<li><a href=\"{{admin_url('qkxiaoxi')}}/"+data.qkxiaoxi[i]['id']+"\/"+data.qkxiaoxi[i]['funds_orderid']+"\"><i class=\"fa fa-users text-red\"></i>&nbsp &nbsp &nbsp &nbsp一条请款审批"+skuanzt[data.qkxiaoxi[i]['funds_statue']]+"</a></li>";
                                }
                                for(var i=0;i<data.jsxiaoxi.length;i++){
                                  cc+="<li><a href=\"{{admin_url('jsxiaoxi')}}/"+data.jsxiaoxi[i]['id']+"\/"+data.jsxiaoxi[i]['deal_orderid']+"\"><i class=\"fa fa-shopping-cart text-green\"></i>&nbsp &nbsp &nbsp &nbsp一条成交单核算完毕</a></li>";
                                }
                                $("#qkxiaoxi3").html(cc);
                            }
                        });
                      }
                      zhuanyuan();
                      setInterval(zhuanyuan,10*1000);
                    });
                </script>
                
              @endif
              {!! Admin::getNavbar()->render() !!}
                <!-- User Account Menu -->
                <li class="dropdown user user-menu">
                    <!-- Menu Toggle Button -->
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <!-- The user image in the navbar-->
                        <img src="{{ Admin::user()->avatar }}" class="user-image" alt="User Image">
                        <!-- hidden-xs hides the username on small devices so only the image appears. -->
                        <span class="hidden-xs">{{ Admin::user()->username }}</span>
                    </a>
                    <ul class="dropdown-menu">
                        <!-- The user image in the menu -->
                        <li class="user-header">
                            <img src="{{ Admin::user()->avatar }}" class="img-circle" alt="User Image">

                            <p>
                                {{ Admin::user()->username }}
                                <small>用户创建时间 {{ Admin::user()->created_at }}</small>
                            </p>
                        </li>
                        <li class="user-footer">
                            <div class="pull-left">
                                <a href="{{ Admin::url('auth/setting') }}" class="btn btn-default btn-flat">个人资料</a>
                            </div>
                            <div class="pull-right">
                                <a href="{{ Admin::url('auth/logout') }}" class="btn btn-default btn-flat">退出</a>
                            </div>
                        </li>
                    </ul>
                </li>
                <!-- Control Sidebar Toggle Button -->
                {{--<li>--}}
                    {{--<a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>--}}
                {{--</li>--}}
            </ul>
        </div>
    </nav>
</header>
